﻿<UserControl x:Class="InkCanvasControl.CInkCanvas"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:InkCanvasControl"
        Background="#FF3B3737">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/InkCanvasControl;component/Themes/Slider.xaml"/>
                <ResourceDictionary Source="pack://application:,,,/InkCanvasControl;component/Themes/CInkCanvas.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <Border >
            <InkCanvas  Background="#FFEEF589" x:Name="inkCanv">
            </InkCanvas>
        </Border>
        <Grid Grid.Column="1" Background="{DynamicResource RightAreaBackground}" >
            <Grid.RowDefinitions>
                <RowDefinition Height="auto"/>
                <RowDefinition Height="auto"/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <StackPanel>
                <Border Background="{DynamicResource TitleBackground}" Height="34">
                    <TextBlock Text="编辑模式"  Style="{DynamicResource TextBlockStyle}"/>
                </Border>
                <WrapPanel Orientation="Horizontal" Width="96" >
                    <RadioButton IsChecked="True" Style="{DynamicResource ModeRadioButtonStyle}" Content="!" FontFamily="Wingdings 2" ToolTip="Ink" Click="rad_Click" Tag="{x:Static InkCanvasEditingMode.Ink}"/>
                    <RadioButton Style="{DynamicResource ModeRadioButtonStyle}" Content="O"  FontFamily="Wingdings 2" ToolTip="Erase" Click="rad_Click" Tag="{x:Static InkCanvasEditingMode.EraseByPoint}"/>
                    <RadioButton Style="{DynamicResource ModeRadioButtonStyle}" Content="Q" FontFamily="Wingdings 2" ToolTip="Erase By Stroke" Click="rad_Click"  Tag="{x:Static InkCanvasEditingMode.EraseByStroke}"/>
                    <RadioButton Style="{DynamicResource ModeRadioButtonStyle}" Content="@" FontFamily="Wingdings 2" ToolTip="Select"  Click="rad_Click"  Tag="{x:Static InkCanvasEditingMode.Select}"/>
                </WrapPanel>
            </StackPanel>
            
            <Border Background="{DynamicResource TitleBackground}" Height="34" Grid.Row="1">
                <TextBlock Text="笔刷粗细"  Style="{DynamicResource TextBlockStyle}" />
            </Border>
            <Grid Grid.Row="2"> 
                <Slider x:Name="strokeThicknessSelector"
                        Margin="0,10,0,20"
                        ValueChanged="strokeThicknessSelector_ValueChanged"
                        Orientation="Vertical" HorizontalAlignment="Center" 
                        Maximum="100" 
                        Minimum="1"
                        TickFrequency="1"
                        IsSnapToTickEnabled="True"
                        SmallChange="1" />
                <TextBlock Text="{Binding Value,ElementName=strokeThicknessSelector,StringFormat=笔刷粗细:{0}px}" VerticalAlignment="Bottom" Foreground="White"/>
            </Grid>
        </Grid>
        <StackPanel >

        </StackPanel>


        <!-- BUTTON STRIP -->
        <Border Grid.Row="1" Grid.Column="0" MinHeight="74" HorizontalAlignment="Center">

            <local:FishEyesPanel x:Name="fishButtons" Magnification="1.5">
                <Button Content="g" Style="{DynamicResource CommandButtonStyle}"  ToolTip="新建" FontSize="28" Command="{x:Static local:CInkCanvas.NewCommand}"/>
                <Button Content="1" Style="{DynamicResource CommandButtonStyle}" FontFamily="Wingdings"  ToolTip="打开" Command="{x:Static local:CInkCanvas.OpenCommand}"/>
                <Button Content="&lt;" Style="{DynamicResource CommandButtonStyle}" FontFamily="Wingdings"  ToolTip="保存" Command="{x:Static local:CInkCanvas.SaveCommand}"/>
                <Button Content="%" Style="{DynamicResource CommandButtonStyle}" FontFamily="Wingdings 2"  ToolTip="剪切" Command="{x:Static local:CInkCanvas.CutCommand}"/>
                <Button Content="2" Style="{DynamicResource CommandButtonStyle}" ToolTip="复制" Command="{x:Static local:CInkCanvas.CopyCommand}"/>
                <Button Content="¤"  Style="{DynamicResource CommandButtonStyle}" ToolTip="粘贴" Command="{x:Static local:CInkCanvas.PasteCommand}"/>
                <Button Content="x" Style="{DynamicResource CommandButtonStyle}" ToolTip="删除" Command="{x:Static local:CInkCanvas.DelCommand}"/>
                <Button Content="¤" Style="{DynamicResource CommandButtonStyle}" FontFamily="Wingdings"  ToolTip="全部选择" Command="{x:Static local:CInkCanvas.SelectAllCommand}"/>
                <Button Content="@" Style="{DynamicResource CommandButtonStyle}"  ToolTip="设置笔刷颜色" Command="{x:Static local:CInkCanvas.SetColorCommand}"/>
            </local:FishEyesPanel>
        </Border>

    </Grid>
</UserControl>
